#ifndef CVehicleEntity_hpp
#define CVehicleEntity_hpp

class CAplicacion;
class CUtiles;

#include "CAplicacion.hpp"
#include "CUtiles.hpp"

#include <Ogre.h>
#include <NxPhysics.h>
#include "vehicle/NxVehicle.h"

using namespace std;
using namespace Ogre;

enum CarType
{
	SPORTCAR,
	MONSTERTRUCK
};

class CVehicleEntity
{
public:

	CVehicleEntity
	(
		String 				id,
		NxVec3				position,	
		NxReal				axisYOrientation,
		NxReal				mass,
		NxVec3				centerOfMass,
		NxReal				maxVelocity,
		NxVehicleMotorDesc	motorConfiguration,
		NxVehicleGearDesc	gearsConfiguration,
		NxReal				differentialRatio,
		bool				useFrontWheelDrive,
		bool				useBackWheelDrive,
		NxReal				chassisLengthX,
		NxReal				chassisLengthY,
		NxReal				chassisLengthZ,
		NxReal				frontAxisWheelsDelta,
		NxReal				upAxisWheelsDelta,
		NxReal				lateralAxisWheelsDelta,
		NxReal				wheelApproximation,
		NxReal				wheelRadius,
		NxReal				wheelSuspension,
		NxReal				springRestitution,
		NxReal				springDamping,
		NxReal				springBias,
		NxReal				maxBrakeForce,
		NxVec3				steeringSteerPoint,
		NxVec3				steeringTurnPoint,
		NxReal				digitalSteeringDelta,
		NxReal				steeringMaxAngle
	);

	CVehicleEntity
	(
		CarType carType, 
		String	id,
		NxVec3	position,	
		NxReal	axisYOrientation
	);

	virtual ~CVehicleEntity();

	void addVehicle(string id);
	
	virtual void refrescar(Real tiempoDesdeUltimoFrame = 0); // !!!

	void disablePhysics();
	void enablePhysics();

	SceneNode * getSceneNodeRoot();

	string getId();

	SceneNode*	sceneNodeRoot; // TODO : must be a protected member

private:

	void postConstruction();
	void postAddChild();

	NxVehicle* vehicle;

protected:

	
	
	
	NxActor* physicsActor;
	String id;
	NxVec3 position;
};

#endif